#include<bits/stdc++.h>
using namespace std;
int a[10000];
int main()
{
	int n,i,s1=0,s2=0;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>a[i];
		if(a[i]%2)
		s1+=a[i];
		if(a[i]%2==0)
		s2+=a[i];
	}
	cout<<s1<<endl<<s2;
    return 0;
}
